<?php
/**
 *	
 * This file represents a publisher that calls a phing task.  The build process 
 * activated if the publishBuildStatus variable matches the buildStatus passed to isActive.
 * 
 * 
 * 
 * @package Xinc.Publishers
 * @author  David Ellis
 * @version 1.0
 * @copyright 2007 David Ellis, One Degree Square
 * @license  http://www.gnu.org/copyleft/lgpl.html GNU/LGPL, see license.php
 *	This file is part of Xinc.
 *	Xinc is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU Lesser General Public License as published by
 *	the Free Software Foundation; either version 2.1 of the License, or
 *	(at your option) any later version.
 *
 *	Xinc is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU Lesser General Public License for more details.
 *
 *	You should have received a copy of the GNU Lesser General Public License
 *	along with Xinc, write to the Free Software
 *	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

class Xinc_Publishers_PhingPublisher implements Xinc_Publisher
{
	private $buildFile;
  	private $target;
	private $publishBuildStatus;
  	
  	public function setBuildFile($buildFile)
  	{	
  		$this->buildFile = $buildFile;
	}
  
  	public function setTarget($target)
  	{
	  	$this->target = $target;
  	}
  
  	public function setPublishBuildStatus($publishBuildStatus)
  	{
  		$this->publishBuildStatus = $publishBuildStatus;
  	}
  	
  	public function isActive($buildStatus) 
  	{
    	//return ($buildStatus==$this->publishBuildStatus);
  		return true;
  	}

  	public function publish() 
  	{
		global $logger;
  		
  		$logger->info("PUBLISHING phing " . $this->target);
	    // 	run the phing build process
	    $phingBuilder = new Xinc_PhingBuilder();
	    $phingBuilder->build($this->target);
  	}
}
?>